UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DYz+J//WGSmnko+mxj2h4wZk18Y4189j2NAp/mhFJJE=' 
WHERE 
  key_id = 'e51d8870aafa63978386b41abcf48c72f9cc1f4a5cd07bf273718fe0022f5cee' 
  AND (
    token = 'DYz+J//WGSmnko+mxj2h4wZk18Y4189j2NAp/mhFJJE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032