UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'henVqT2HVWTE6iRx3DNzFaV4N63mRJSNgFvzQzoSNYI=' 
WHERE 
  key_id = '8a6316ef3ac240611ce4fa91f477aa9927006639eaa28c45911b68ac43c564a1' 
  AND (
    token = 'henVqT2HVWTE6iRx3DNzFaV4N63mRJSNgFvzQzoSNYI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030