UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+sdR7pyGUbY6zq5d4Mp1D+ErbJ0NMI/AlrbZ159P3IU=' 
WHERE 
  key_id = 'a07e33f534b6dd170e5064b070066f8e5ef4b530cf05652b8b477b4971b99127' 
  AND (
    token = '+sdR7pyGUbY6zq5d4Mp1D+ErbJ0NMI/AlrbZ159P3IU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030