UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dqMurPOD2D9H4a520wgcZ9Ils8mhL9sIEMvHnkeDS+k=' 
WHERE 
  key_id = 'b4bf90dd24f87e020a3117671d5f0c86d54d0be90ed547401fcaec57c45ead19' 
  AND (
    token = 'dqMurPOD2D9H4a520wgcZ9Ils8mhL9sIEMvHnkeDS+k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038