UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pZRx4+55CQL8qHsWSG3qzvAufA6IYK3efQGiag6jcx8=' 
WHERE 
  key_id = '5bf1202ea326feabc7dff99406a5efee974d2998d8fe2b8da35e03ac1394eb60' 
  AND (
    token = 'pZRx4+55CQL8qHsWSG3qzvAufA6IYK3efQGiag6jcx8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037