UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aYisrn37SzuGazcqSRDtcHz0bYiNdsaTsBA6dQ6hKrk=' 
WHERE 
  key_id = '6e52e6b47d5a4c537e9682d0b718b4af1be079d010990a1ee7a5f0ed70317dce' 
  AND (
    token = 'aYisrn37SzuGazcqSRDtcHz0bYiNdsaTsBA6dQ6hKrk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024