UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h/g/lvUA4A0TWa2OnWbqp0NUk5JGiwfGbJbzjFejrQY=' 
WHERE 
  key_id = '113e67bca275b2084c7f52cb21d8f5661cd12939d3eb36186f471c625342c426' 
  AND (
    token = 'h/g/lvUA4A0TWa2OnWbqp0NUk5JGiwfGbJbzjFejrQY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039