UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a+Zopy3tw/wLtZ1LMiSVRCBwa8XgJ2YupmWaYLGomqc=' 
WHERE 
  key_id = '22f82eac0039e17f000a6027cab05cc3b4200001bae62cddb254167184ab978c' 
  AND (
    token = 'a+Zopy3tw/wLtZ1LMiSVRCBwa8XgJ2YupmWaYLGomqc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039