UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lR3MfIk7uqmIJ1DpYPsIuGHwhOt/wDEihGv+607YQss=' 
WHERE 
  key_id = '7e2490d334a3650348def728cfa72f047d3fdb438deacd505b4c188fa49f3e73' 
  AND (
    token = 'lR3MfIk7uqmIJ1DpYPsIuGHwhOt/wDEihGv+607YQss=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030