UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3rc8Gfk0Q9bm/+J1JXjdEmdJZBt4J+ioyXxPFoGg+Ss=' 
WHERE 
  key_id = '4af92af9190fbba7bc2d7bf0ed5329cec62a8203d26857a5c89fee8d78417268' 
  AND (
    token = '3rc8Gfk0Q9bm/+J1JXjdEmdJZBt4J+ioyXxPFoGg+Ss=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026