UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LblSI/yIM3+ijV/u+DfnvV92i/HCLks6keY49xrKxIc=' 
WHERE 
  key_id = 'e47da182d54103330696f8c15c296ade682f4c6350861e25e23160c639d0fbf7' 
  AND (
    token = 'LblSI/yIM3+ijV/u+DfnvV92i/HCLks6keY49xrKxIc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00136