UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U2p7GkfySTubwYR7Ftij97TeKx0+8fccouw+RM6LiM8=' 
WHERE 
  key_id = '53e3c570eab837354019956aa0f53be5563a212889a3b24bc8e7e9914efa4e76' 
  AND (
    token = 'U2p7GkfySTubwYR7Ftij97TeKx0+8fccouw+RM6LiM8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027