UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'azL1nW7JYaOb5eZHhblR2U1L+343ti1KOa+xoJJ0+JE=' 
WHERE 
  key_id = '001d0a12deab1eb7a747a8863f2100a22ee7a114cf477eab8e266cbafd17b8df' 
  AND (
    token = 'azL1nW7JYaOb5eZHhblR2U1L+343ti1KOa+xoJJ0+JE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040