UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qWjB/xA5//qPOulJUythRxgriyr43y3OVXAbzL3nsbk=' 
WHERE 
  key_id = '28f21818235248804e57202e4b548011782c546d5a8fa0a6a1e76df764905177' 
  AND (
    token = 'qWjB/xA5//qPOulJUythRxgriyr43y3OVXAbzL3nsbk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038