UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tBwZnghlG+A15Tp6pdPnnQ0gaOcUo1n5lW17HT1UxRE=' 
WHERE 
  key_id = 'b3e3bc0e3bc9276a3324f1c355e9a0ba64ec2ba497ddc8f3e96d1800d51e27ea' 
  AND (
    token = 'tBwZnghlG+A15Tp6pdPnnQ0gaOcUo1n5lW17HT1UxRE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043