UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j74+JkIxkwr4+QQN9X6IogcDrRLlqnwqJEa+bXqx9HU=' 
WHERE 
  key_id = 'bfddf8211e61d07df0b7c6125cdd68b78a2abdbd0e1eee92098ad2f2db16880b' 
  AND (
    token = 'j74+JkIxkwr4+QQN9X6IogcDrRLlqnwqJEa+bXqx9HU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028