UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '551mYt/oaslVXoYkKDm7DEvVCwFZL9mojSqvONqgODc=' 
WHERE 
  key_id = 'fe830d0bafa5b0353cfd1c5de4d0f5d61bfd8d7d30e31aa46727889eb20e6e2d' 
  AND (
    token = '551mYt/oaslVXoYkKDm7DEvVCwFZL9mojSqvONqgODc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042