UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QVkDstGElNo7Vy/c9e7R6AiCTxRZysjaLcwrlS+Cgwg=' 
WHERE 
  key_id = '19f8409ac80ebb5dfeb471c14060330313c6ff6789387bfc6867a0c6a0771d5f' 
  AND (
    token = 'QVkDstGElNo7Vy/c9e7R6AiCTxRZysjaLcwrlS+Cgwg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042