UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XvIe0DWAAy9xYgi4T2UcUBnYtQeXNnaP6BBX97TniZM=' 
WHERE 
  key_id = '1b7be615b9d231512791e16869e2634df8ce79b494a02e32443403ff002aefae' 
  AND (
    token = 'XvIe0DWAAy9xYgi4T2UcUBnYtQeXNnaP6BBX97TniZM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059