UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AJxxp6ZLBnNXjPUenNJ5YoD0/+8nF3yAuB25zmeyglI=' 
WHERE 
  key_id = '776e115de16782a9b2f1c35261251e4f20de17b80b4de15c573fa766e08f764f' 
  AND (
    token = 'AJxxp6ZLBnNXjPUenNJ5YoD0/+8nF3yAuB25zmeyglI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059