UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h/Z+WGrVXlUbYr/AmyWv4GmE6SOwO/p1Qt3J+2BCna4=' 
WHERE 
  key_id = '21ec98b1065c175cf072378a7bccd4e11fc524106c1e02e8e43b3104290fb8ea' 
  AND (
    token = 'h/Z+WGrVXlUbYr/AmyWv4GmE6SOwO/p1Qt3J+2BCna4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023