UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tCtci3C0ishUlqPx9r8VJY2emnN0PygS/xae+8kQETg=' 
WHERE 
  key_id = '1927de11e65393ec59147b733c8728c4dc6172201856bee806953e148945b02c' 
  AND (
    token = 'tCtci3C0ishUlqPx9r8VJY2emnN0PygS/xae+8kQETg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036