UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JjsWsfJxcpvTBHFNRYlPeCgkyNc0kfIY2DTLt2L/8uQ=' 
WHERE 
  key_id = 'af9ec0cb665c8678860c2cfdb22e3b041ab23c024884bc55502b0d40b799804d' 
  AND (
    token = 'JjsWsfJxcpvTBHFNRYlPeCgkyNc0kfIY2DTLt2L/8uQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020