UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'axSVFFAj/fN3DzObgTt996x5x5AK/u7u6gr864n+DVM=' 
WHERE 
  key_id = 'b8bc05bd53e1b7337332b640521ad768159109182f790a0f40701103e20e1810' 
  AND (
    token = 'axSVFFAj/fN3DzObgTt996x5x5AK/u7u6gr864n+DVM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039