UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5zPCpmHYuTIcR+ORm7mEAuudLxyWjirdpd6hi8c4QiY=' 
WHERE 
  key_id = 'd2e300a254d6bf92d81699c83c8db323e3beb2fec6e4be3dd8fda2b8d79ecefb' 
  AND (
    token = '5zPCpmHYuTIcR+ORm7mEAuudLxyWjirdpd6hi8c4QiY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037