UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zpnCdudVmoqd54LDERo2d7beUYarZogP1M8SZKvrlqE=' 
WHERE 
  key_id = 'b183b4a88a102475ebbe9df5f163b84f71ef82383a5b4ad756ace59f87bb110a' 
  AND (
    token = 'zpnCdudVmoqd54LDERo2d7beUYarZogP1M8SZKvrlqE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034