UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oO3nFSlBmJ5XRZVo7IXSboeOkGHkmJbgnkStKmP0Ul8=' 
WHERE 
  key_id = '854a145f345c7eb68dcd774ccbe8ae151b8217558b2a1c409c95b9866ab867fb' 
  AND (
    token = 'oO3nFSlBmJ5XRZVo7IXSboeOkGHkmJbgnkStKmP0Ul8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037