UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DKD5LUxkJsQIhDCNKABaoL7l6SmllUYmwKMzkew6ukI=' 
WHERE 
  key_id = '7f40cbf8108d70f060327e24ac24b280783926e34345854184e6016ced631e5f' 
  AND (
    token = 'DKD5LUxkJsQIhDCNKABaoL7l6SmllUYmwKMzkew6ukI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031