UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '11+bCaSIxTAg7GB/Pb34AmbexvsphSE1Ild156Rqk7w=' 
WHERE 
  key_id = 'c7cb6b5add2973cec45ba52a3e26617b192382940dde4ef5eaa10b5216250cd4' 
  AND (
    token = '11+bCaSIxTAg7GB/Pb34AmbexvsphSE1Ild156Rqk7w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030