UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Nx3scdRGnh7tgIdecPmYJErq7ImeEx5wB4mayJ+sCpI=' 
WHERE 
  key_id = 'a2f2da224565ea1072f08281c0f34b1c5e9dc12499cfb7d9afb7a2639340cac6' 
  AND (
    token = 'Nx3scdRGnh7tgIdecPmYJErq7ImeEx5wB4mayJ+sCpI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031