UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HGeisi7tYQzppUgPaX9Qr4xeD08gNUKoPfQKHWQNeYA=' 
WHERE 
  key_id = '9074a1184e6ce143b9a36959153897694d3a44d1a9f9095606dd133885348d94' 
  AND (
    token = 'HGeisi7tYQzppUgPaX9Qr4xeD08gNUKoPfQKHWQNeYA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028